package com.guiguli.systemDemo1;

import com.guiguli.MathDemo2.MathDemo2;

public class systemDemo1 {
    public static void main(String[] args) {
        //0:表示当前虚拟机正常停止
        //非0:表示当前虚拟机异常停止
        //System.exit(0);

        var start =System.currentTimeMillis();
        //判断1-100000之间有多少个质数
        for (int i = 0; i <= 100000; i++) {
            boolean flag = MathDemo2.isPrime(i);
            if(flag)
                System.out.println(i);
        }
        var end = System.currentTimeMillis();
        System.out.println("第一个方法用时: "+(end-start));  //用时80毫秒

        start = System.currentTimeMillis();
        for (int i = 0; i <= 100000; i++) {
            boolean flag = MathDemo2.isPrime2(i);
            if(flag)
                System.out.println(i);
        }
        end = System.currentTimeMillis();
        System.out.println("第二个方法用时: "+(end-start));    //用时1672毫秒
    }
}
